<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="common/index :: head"></head>
<body class="mainbody">
<div th:replace="common/index :: location('客户管理')"></div>
<!--<div th:replace="common/index :: toolbar"></div>-->
<form id="searchForm" method="GET" th:object="${search}">
    <input type="hidden" name="page" th:value="${page.number+1}" />
    <input type="hidden" name="size" th:value="${page.size}" />
    <div class="det-list clearfix">
        <div class="group btm">
            <div class="control">
                <div class="title">名称</div>
                <input class="input normal" type="text" th:field="*{nickName}"/>
            </div>
            <div class="control">
                <div class="title">地址</div>
                <input class="input normal" type="text" th:field="*{address}"/>
            </div>
            <div class="control">
                <div class="title">性别</div>
                <div class="rule-single-select">
                    <select th:field="*{sex}" th:with="sexList=${@dictService.getDict('sex')}">
                        <option value="">请选择...</option>
                        <option th:each="temp : ${sexList}"
                                th:value="${temp.value}"
                                th:text="${temp.label}"></option>
                    </select>
                </div>
            </div>
        </div>
        <div class="group searchbtn">
            <div class="btn-list">
                <input type="submit" value="查询" class="btn" />
                <input type="reset" value="重置" class="btn yellow" />
            </div>
        </div>
        <div style="clear:both;"></div>
    </div>
</form>

<table id="list">
    <thead>
    <tr>
        <th width="150"  style="text-align:center;">操作</th>
        <th width="100">编号</th>
        <th width="100">名称</th>
        <th width="150">头像</th>
        <th width="150">性别</th>
        <th width="150">地址</th>
        <th width="200">openId</th>
    </tr>
    </thead>
    <tbody>
    <tr th:each="obj : ${page.content}" th:object="${obj}">
        <td><a>查看</a></td>
        <td th:text="*{id}"></td>
        <td th:text="*{nickName}"></td>
        <td th:text="*{avatar}"></td>
        <td th:with="sexList=${@dictService.getDict('sex')}"
            th:text="${sexList.^[value eq #strings.toString(#root.obj.sex)]?.label}"></td>
        <td th:text="*{address}"></td>
        <td th:text="*{openId}"></td>
    </tr>
    </tbody>
</table>

<div th:replace="common/index :: pagination(${page})"></div>
<script type="text/javascript" th:replace="common/index :: indexscript"></script>
<script>
    function deleteObj(id){
        if(confirm("确认删除?")) location.href=id+"/delete";
    }
</script>
</body>
</html>